package com.fit.dao.arrangement;

import java.util.List;

import org.apache.tapestry5.hibernate.annotations.CommitAfter;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;

import com.fit.entities.Arrangement;

public class ArrangementDAOImpl implements ArrangementDAO {

	@Inject
	private Session session;
	
	@CommitAfter
	public boolean save(Arrangement arrangement) {
		if(arrangement != null) {
			session.save(arrangement);
			return true;
		}
		return false;
	}

	public Arrangement findById(Long id) {
		return (Arrangement) session.get(Arrangement.class, id);
	}

	public List<Arrangement> findAll() {
		return session.createCriteria(Arrangement.class).list();
	}

}
